import os
import tornado.ioloop
import tornado.web

# 定义文件上传处理类
class FileUploadHandler(tornado.web.RequestHandler):
    def post(self):
        fileinfo = self.request.files['filearg'][0]
        # 获取上传文件的文件名
        filename = fileinfo['filename']
        # 拼接文件保存的完整路径
        save_path = os.path.join("d:\\Project\\Other\\model_test\\code\\03_005", filename)
        with open(save_path, 'wb') as f:
            f.write(fileinfo['body'])
        self.write("文件上传成功！")

# 创建Tornado应用并设置路由
def make_app():
    return tornado.web.Application([
        (r"/upload", FileUploadHandler),
    ])

if __name__ == "__main__":
    app = make_app()
    app.listen(8888)
    tornado.ioloop.IOLoop.current().start()